/**
 * 
 */
package jp.co.ufp.adapter;

import java.util.List;

import jp.co.ufp.R;
import jp.co.ufp.bean.ItemBean;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

/**
 * @author akira
 * 
 */
public class ListAdapter extends ArrayAdapter<ItemBean> {

    private LayoutInflater mInflater;

    private TextView textView1;

    // private ToggleButton tbtn1;

    public ListAdapter(Context context, List<ItemBean> objects) {
	super(context, 0, objects);
	mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public View getView(final int position, View convertView, ViewGroup parent) {
	View view = convertView;
	if (convertView == null) {
	    view = mInflater.inflate(R.layout.togglerows, null);
	}
	ItemBean item = this.getItem(position);
	if (item != null) {
	    String name = item.getName().toString();
	    textView1 = (TextView) view.findViewById(R.id.textView1);
	    textView1.setText(name);
	    // tbtn1 = (ToggleButton) view.findViewById(R.id.tbtn1);
	}
	return view;
    }
}